refactor: eliminate duplicate data, simplify dependencies, fix singleton issues#350
Merged
refactor: eliminate duplicate data, simplify dependencies, fix singleton issues#350
Conversation
…server singleton issues - Merge testItems Map into TestDefinitionIndex with URI-based grouping (set/deleteByUri/getDefinitionsByUri) - Add O(1) fileIndex lookup in BaseTestCollection.findFile() - Simplify DebugSessionManager to inject WorkspaceFolder directly instead of TestCollection - Extract TestRunnerObserverFactory to create fresh observer instances per test run, eliminating shared mutable state in singleton OutputChannelObserver - Remove @Injectable() from OutputChannelObserver and ErrorDialogObserver (no longer DI-managed) - Apply early return pattern in PHPUnitXML, AttributeParser, and TestCommandRegistry
OutputFormatter/CollisionPrinter held per-run mutable state (outputBuffer, errors[]) as a parent container singleton. When two workspace folders ran tests concurrently, their output would interleave and errors could be attributed to the wrong folder or lost entirely. - Remove @Injectable from OutputFormatter and CollisionPrinter - Remove OutputFormatter binding from parent container - Create new CollisionPrinter instance per test run in TestRunnerObserverFactory
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #350 +/- ##
==========================================
- Coverage 94.54% 94.48% -0.06%
==========================================
Files 76 77 +1
Lines 2785 2813 +28
Branches 489 495 +6
==========================================
+ Hits 2633 2658 +25
- Misses 137 140 +3
Partials 15 15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
testItemsintoTestDefinitionIndex— added URI-based grouping (set/deleteByUri/getDefinitionsByUri), removed redundanttestItemsMap fromTestCollectionfindFile()lookup — addedfileIndexMap inBaseTestCollection, replacing O(N) linear scanDebugSessionManager— injectWorkspaceFolderdirectly instead ofTestCollectionTestRunnerObserverFactoryto create freshOutputChannelObserver/ErrorDialogObserverper test run, eliminating shared mutable stateOutputFormattersingleton issue — create newCollisionPrinterper run instead of global singleton, preventing cross-folder output interleavingPHPUnitXML,AttributeParser,TestCommandRegistryTest plan
npx vitest run)